# Time log:
# June 13 - 8:00am @ 9:15am
#

#
# = The ActiveField mixin.
#
# == Description
# TODO: doc
# TODO: integrate with form_for
# FIXME: where to put require 'active_field' ?
#   in environment.rb, initializers, application.rb ??
# see it like a bridge between ActiveRecord and ActionView
#
# == Author
# David Lauzon, www.davidlauzon.net
#

require 'active_field/active_record'      # ActiveRecord Hooks & Methods
require 'active_field/core'               # Core functionality
require 'active_field/fields/core_fields' # Support for basic fields (ie: integer, string, etc)

#require 'active_support/core_ext/string/inflections'
#require 'active_support' # DOES NOT WORK !!!
module ActiveField

  CONFIG = {
    #
    # Sets the association between ActiveRecord types (value of @type in your Model.columns), 
    # and the ActiveField
    #
    #=begin
    :ar_mapping => {
      :integer => ActiveField::Fields::IntegerField,
      :decimal => ActiveField::Fields::DecimalField,
      :float   => ActiveField::Fields::FloatField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :integer => ActiveField::Fields::IntegerField,
      :text    => ActiveField::Fields::TextField,
      :string  => ActiveField::Fields::StringField,
      #:text => Fields::TextField
    }
    #=end
  }
  
  #
  # Sets the association between @sql_type found in the @columns in your model, 
  # and the ActiveField
  #TODO: allow mapping based on sql_type
  #CONFIG[:sql_mapping] = {
  #  :integer => ActiveField
  #}
  
end

